﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SecurePasswords
{
    public partial class MasterPasswordForm : Form
    {
        public string Message
        {
            get { return lblMasterPassword.Text; }
            set { lblMasterPassword.Text = value; }
        }

        public string Password
        {
            get { return txtMasterPassword.Text; }
        }

        private bool hidePassword = false;

        public bool HidePassword
        {
            get { return hidePassword; }
            set { hidePassword = value;
                if (hidePassword)
                    {
                        txtMasterPassword.PasswordChar = '*';
                }
                else
                {
                    txtMasterPassword.PasswordChar = (char)0;
                }
            }
        }


        public MasterPasswordForm()
        {
            InitializeComponent();
        }


        private void txtMasterPassword_KeyPress(object sender, KeyPressEventArgs e)
        {
            //check for enter
            if (e.KeyChar == (char)Keys.Enter)
            {
                btnMasterPassword_Click(sender, e);
            }
        }

        private void btnMasterPassword_Click(object sender, EventArgs e)
        {
            if (txtMasterPassword.Text.Length > 0)
            {
                Close();
            }
        }

        private void txtBox_LostFocus(object sender, EventArgs e)
        {
            inputPanel1.Enabled = false;

        }

        private void txtMasterPassword_GotFocus(object sender, EventArgs e)
        {
            inputPanel1.Enabled = true;
        }

    }
}